package com.niit.web.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.niit.bean.User;
import com.niit.bean.UserInfo;
import com.niit.service.UserInfoService;
import com.niit.service.impl.UserInfoServiceImpl;

@WebServlet("/UpdateSignatureController")
public class UpdateSignatureController extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		User user = (User) request.getSession().getAttribute("user");
		String signature = request.getParameter("signature");
		UserInfoService uis = new UserInfoServiceImpl();
		UserInfo info = uis.findByUser(user);
		info.setSignature(signature);
		if(uis.update(info)>0){
			response.getOutputStream().write("1".getBytes());
		}
	}

}
